package it.storm.solution;

/**
 * 674. 最长连续递增序列
 * https://leetcode-cn.com/problems/longest-continuous-increasing-subsequence/
 */
public class Solutions_674 {
    public static void main(String[] args) {
//        int[] nums = {1, 3, 5, 4, 7};  // output: 3
//        int[] nums = {2, 2, 2, 2, 2};  // output: 1
        int[] nums = {};  // output: 0

        int result = findLengthOfLCIS(nums);
        System.out.println(result);
    }

    public static int findLengthOfLCIS(int[] nums) {
        int res = 0;
        if (nums == null || nums.length < 1) {
            return res;
        }
        int count = 1;

        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i - 1]) {
                count ++;
            } else {
                res = Math.max(res, count);
                count = 1;
            }
        }
        // 不要忘掉最后一位是递增序列的情况
        if (count > res) {
            res = count;
        }
        return res;
    }
}
